#!/usr/bin/env python
# coding:utf-8
import math
from sina_finance_base import SinaFinanceBase


class SinaFinance(SinaFinanceBase):
    def __init__(self):
        super().__init__()

    def qbgg_hk(self):
        type = "qbgg_hk"
        counter = self.query_stock_count_by_type(type)
        size = 80
        page_count = math.ceil(counter / size)
        result = []
        for page in range(page_count):
            stock_list = self.qery_stock_list_by_type(type, page=page, size=size)
            for item in stock_list:
                result.append({
                    "symbol": item.get("symbol", ""),
                    "name": item.get("name", ""),
                    "engname": item.get("engname", ""),
                    "reg": "hk",
                })
        return result


if __name__ == "__main__":
    finance = SinaFinance()
    print(finance.qbgg_hk())
